package rpd.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import rpd.model.TbRecruitmentInformation;
import rpd.model.TbRecruitmentInformationExample;
import rpd.model.TbRecruitmentInformationKey;

public interface TbRecruitmentInformationMapper {
    long countByExample(TbRecruitmentInformationExample example);

    int deleteByExample(TbRecruitmentInformationExample example);

    @Delete({
        "delete from tb_recruitment_information",
        "where ri_id = #{riId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(TbRecruitmentInformationKey key);

    @Insert({
        "insert into tb_recruitment_information (ri_id, position_code, ",
        "position_desc, demand_exp_code, ",
        "demand_exp_desc, educational_background_code, ",
        "educational_background_desc, major_code, ",
        "major_desc, number, publish_time, ",
        "benefits, description, ",
        "job_requirement, ability_requirement, ",
        "position_type_codes, position_type_descs, ",
        "contact_way, company_id)",
        "values (#{riId,jdbcType=CHAR}, #{positionCode,jdbcType=CHAR}, ",
        "#{positionDesc,jdbcType=CHAR}, #{demandExpCode,jdbcType=CHAR}, ",
        "#{demandExpDesc,jdbcType=CHAR}, #{educationalBackgroundCode,jdbcType=CHAR}, ",
        "#{educationalBackgroundDesc,jdbcType=CHAR}, #{majorCode,jdbcType=CHAR}, ",
        "#{majorDesc,jdbcType=CHAR}, #{number,jdbcType=CHAR}, #{publishTime,jdbcType=CHAR}, ",
        "#{benefits,jdbcType=CHAR}, #{description,jdbcType=CHAR}, ",
        "#{jobRequirement,jdbcType=CHAR}, #{abilityRequirement,jdbcType=CHAR}, ",
        "#{positionTypeCodes,jdbcType=CHAR}, #{positionTypeDescs,jdbcType=CHAR}, ",
        "#{contactWay,jdbcType=CHAR}, #{companyId,jdbcType=CHAR})"
    })
    int insert(TbRecruitmentInformation record);

    int insertSelective(TbRecruitmentInformation record);

    List<TbRecruitmentInformation> selectByExample(TbRecruitmentInformationExample example);

    @Select({
        "select",
        "ri_id, position_code, position_desc, demand_exp_code, demand_exp_desc, educational_background_code, ",
        "educational_background_desc, major_code, major_desc, number, publish_time, benefits, ",
        "description, job_requirement, ability_requirement, position_type_codes, position_type_descs, ",
        "contact_way, company_id",
        "from tb_recruitment_information",
        "where ri_id = #{riId,jdbcType=CHAR}"
    })
    @ResultMap("rpd.mapper.TbRecruitmentInformationMapper.BaseResultMap")
    TbRecruitmentInformation selectByPrimaryKey(TbRecruitmentInformationKey key);

    int updateByExampleSelective(@Param("record") TbRecruitmentInformation record, @Param("example") TbRecruitmentInformationExample example);

    int updateByExample(@Param("record") TbRecruitmentInformation record, @Param("example") TbRecruitmentInformationExample example);

    int updateByPrimaryKeySelective(TbRecruitmentInformation record);

    @Update({
        "update tb_recruitment_information",
        "set position_code = #{positionCode,jdbcType=CHAR},",
          "position_desc = #{positionDesc,jdbcType=CHAR},",
          "demand_exp_code = #{demandExpCode,jdbcType=CHAR},",
          "demand_exp_desc = #{demandExpDesc,jdbcType=CHAR},",
          "educational_background_code = #{educationalBackgroundCode,jdbcType=CHAR},",
          "educational_background_desc = #{educationalBackgroundDesc,jdbcType=CHAR},",
          "major_code = #{majorCode,jdbcType=CHAR},",
          "major_desc = #{majorDesc,jdbcType=CHAR},",
          "number = #{number,jdbcType=CHAR},",
          "publish_time = #{publishTime,jdbcType=CHAR},",
          "benefits = #{benefits,jdbcType=CHAR},",
          "description = #{description,jdbcType=CHAR},",
          "job_requirement = #{jobRequirement,jdbcType=CHAR},",
          "ability_requirement = #{abilityRequirement,jdbcType=CHAR},",
          "position_type_codes = #{positionTypeCodes,jdbcType=CHAR},",
          "position_type_descs = #{positionTypeDescs,jdbcType=CHAR},",
          "contact_way = #{contactWay,jdbcType=CHAR},",
          "company_id = #{companyId,jdbcType=CHAR}",
        "where ri_id = #{riId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(TbRecruitmentInformation record);
}